package com.kxmall.web.controller.riderNotice;

import com.kxmall.common.core.controller.BaseRiderController;
import com.kxmall.common.core.domain.PageQuery;
import com.kxmall.common.core.page.TableDataInfo;
import com.kxmall.system.domain.SysNotice;
import com.kxmall.web.controller.riderNotice.service.IRiderNoticetService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 公告
 *
 * @author kxmall
 * @date 2023-04-06
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/notice/riderApp")
public class RiderNoticeController extends BaseRiderController {

    private final IRiderNoticetService iRiderNoticetService;

    /**
     * 查询公告列表
     */
    @GetMapping("/list")
    public TableDataInfo<SysNotice> list(PageQuery pageQuery) {
        SysNotice bo = new SysNotice();
        Long userId = getRiderLoginUser().getUserId();
        bo.setUserId(userId);
        bo.setUserType(2);
        pageQuery.setOrderByColumn("create_time");
        pageQuery.setIsAsc("desc");

        return iRiderNoticetService.queryPageList(bo, pageQuery);
    }

}
